🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / settings / src / commonMain / kotlin / org / meshtastic / feature / settings / radio / component / LicensedModeSetting.kt
Displaying Raw • Download
feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/component/LicensedModeSetting.kt 65a1f5ce4d0e4b8eafcd0bbfccafd41dc6ee888a (65a1f5ce) Text, 3.81 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.settings.radio.component
Tff7b72import T7ee787androidx.compose.material3.CardDefaults
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.runtime.LaunchedEffect
Tff7b72import T7ee787androidx.compose.runtime.getValue
Tff7b72import T7ee787androidx.compose.runtime.mutableStateOf
Tff7b72import T7ee787androidx.compose.runtime.saveable.rememberSaveable
Tff7b72import T7ee787androidx.compose.runtime.setValue
Tff7b72import T7ee787androidx.compose.ui.Modifier
Tff7b72import T7ee787androidx.compose.ui.platform.testTag
Tff7b72import T7ee787org.jetbrains.compose.resources.stringResource
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.licensed_amateur_radio
Tff7b72import T7ee787org.meshtastic.core.resources.licensed_amateur_radio_text
Tff7b72import T7ee787org.meshtastic.core.resources.licensed_mode_enable_confirm
Tff7b72import T7ee787org.meshtastic.core.resources.licensed_mode_enable_title
Tff7b72import T7ee787org.meshtastic.core.resources.licensed_mode_enable_warning
Tff7b72import T7ee787org.meshtastic.core.resources.licensed_mode_enable_warning_signed
Tff7b72import T7ee787org.meshtastic.core.ui.component.MeshtasticResourceDialog
Tff7b72import T7ee787org.meshtastic.core.ui.component.SwitchPreference
Tff7b72internal Tff7b72const Tff7b72val Te6edf3LICENSED_MODE_SWITCH_TEST_TAG Tff7b72= Ta5d6ff"Ta5d6fflicensed_mode_switchTa5d6ff"
T8b949e/**
* The licensed (ham) mode toggle. Enabling is staged behind a confirmation dialog: on firmware that signs licensed
* traffic (design#122, `has_xeddsa`), the copy explains authenticated-but-plaintext operation and the one-time node
* number migration; otherwise it carries the legacy plaintext/compatibility warning. Disabling applies immediately.
*/
Tf0883e@Composable
Tff7b72internal Tff7b72fun Td2a8ffLicensedModeSettingTb4b4b4(
Te6edf3checkedTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3enabledTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3signingSupportedTb4b4b4: Tffa657Boolean?Tb4b4b4,
Te6edf3onCheckedChangeTb4b4b4: Tb4b4b4(Tffa657BooleanTb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Tb4b4b4) Tb4b4b4{
Tff7b72var Te6edf3showEnableConfirmation Tff7b72by Te6edf3rememberSaveable Tb4b4b4{ Te6edf3mutableStateOfTb4b4b4(Tff7b72falseTb4b4b4) Tb4b4b4}
Te6edf3LaunchedEffectTb4b4b4(Te6edf3enabledTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Tff7b72!Te6edf3enabledTb4b4b4) Tb4b4b4{
Te6edf3showEnableConfirmation Tff7b72= Tff7b72false
Tb4b4b4}
Tb4b4b4}
Tff7b72if Tb4b4b4(Te6edf3showEnableConfirmationTb4b4b4) Tb4b4b4{
Te6edf3MeshtasticResourceDialogTb4b4b4(
Te6edf3titleRes Tff7b72= Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3licensed_mode_enable_titleTb4b4b4,
Te6edf3messageRes Tff7b72=
Tff7b72if Tb4b4b4(Te6edf3signingSupported Tff7b72=Tff7b72= Tff7b72trueTb4b4b4) Tb4b4b4{
Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3licensed_mode_enable_warning_signed
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3licensed_mode_enable_warning
Tb4b4b4}Tb4b4b4,
Te6edf3confirmTextRes Tff7b72= Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3licensed_mode_enable_confirmTb4b4b4,
Te6edf3onConfirm Tff7b72= Tb4b4b4{
Te6edf3showEnableConfirmation Tff7b72= Tff7b72false
Tff7b72if Tb4b4b4(Te6edf3enabledTb4b4b4) Tb4b4b4{
Te6edf3onCheckedChangeTb4b4b4(Tff7b72trueTb4b4b4)
Tb4b4b4}
Tb4b4b4}Tb4b4b4,
Te6edf3onDismiss Tff7b72= Tb4b4b4{ Te6edf3showEnableConfirmation Tff7b72= Tff7b72false Tb4b4b4}Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Te6edf3SwitchPreferenceTb4b4b4(
Te6edf3title Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3licensed_amateur_radioTb4b4b4)Tb4b4b4,
Te6edf3summary Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3licensed_amateur_radio_textTb4b4b4)Tb4b4b4,
Te6edf3checked Tff7b72= Te6edf3checkedTb4b4b4,
Te6edf3enabled Tff7b72= Te6edf3enabledTb4b4b4,
Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3testTagTb4b4b4(Te6edf3LICENSED_MODE_SWITCH_TEST_TAGTb4b4b4)Tb4b4b4,
Te6edf3onCheckedChange Tff7b72= Tb4b4b4{ Te6edf3licensed Tff7b72-Tff7b72>
Tff7b72if Tb4b4b4(Te6edf3licensed Tff7b72&Tff7b72& Tff7b72!Te6edf3checkedTb4b4b4) Tb4b4b4{
Te6edf3showEnableConfirmation Tff7b72= Tff7b72true
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3onCheckedChangeTb4b4b4(Te6edf3licensedTb4b4b4)
Tb4b4b4}
Tb4b4b4}Tb4b4b4,
Te6edf3containerColor Tff7b72= Te6edf3CardDefaultsTb4b4b4.Te6edf3cardColorsTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3containerColorTb4b4b4,
Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s